package de.bk.timecalc.midlet.statemachine;

import javax.microedition.lcdui.Command;
import javax.microedition.lcdui.CommandListener;
import javax.microedition.lcdui.Item;
import javax.microedition.lcdui.ItemCommandListener;
import javax.microedition.lcdui.TextField;

public class CommandListenerGame extends AbstractCommandListener implements
    ItemCommandListener
{
  CommandListenerGame(GuiStateGame state)
  {
    super(state);
  }

  /**
   * {@inheritDoc}
   * 
   * @see CommandListener#commandAction(Command, Item)
   */
  public void commandAction(Command command, Item item)
  {
    TextField textField = (TextField) item;
    this.getStateGame().checkAnswer(textField.getString());

  }

  private GuiStateGame getStateGame()
  {
    return ((GuiStateGame) this.getState());
  }
}
